package com.ndp.fb.walle.business.impl;

import com.alibaba.dubbo.config.annotation.Reference;
import com.ndp.fb.rdb.api.AdPublishAppAccountCPARdbService;
import com.ndp.fb.rdb.api.EntrustAccountRdbService;
import com.ndp.fb.rdb.api.ProductConfigurationRdbService;
import com.ndp.fb.rdb.model.AdPublishAppAccountCPA;
import com.ndp.fb.walle.business.AdPublishAppAccountCPAService;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * Created by Evan on 2015/3/18 11:35.
 */
@Component
public class AdPublishAppAccountCPAServiceImpl implements AdPublishAppAccountCPAService
{

    private final org.slf4j.Logger logger = LoggerFactory.getLogger(getClass());

    @Reference
    private ProductConfigurationRdbService productConfigurationRdbService;

    @Reference
    EntrustAccountRdbService entrustAccountRdbService;

    @Reference
    AdPublishAppAccountCPARdbService adPublishAppAccountCPARdbService;


	/** 
	 * @discription
	 * @author giser.yang       
	 * 创建时间 2015年6月1日 下午3:59:40      
	 * @param accountId
	 * @param prodConfId
	 * @param connectionObjectId
	 * @return     
	 */
	    
	@Override
	public Boolean isSupportCPA(Long accountId,
			Long prodConfId, Long connectionObjectId) {
		//2、拉取最新的产品 平台 账户，之前设置过支持CPA的要更新返回
        AdPublishAppAccountCPA cpa = adPublishAppAccountCPARdbService.getCPA(connectionObjectId, prodConfId, accountId);
        return cpa==null?false:cpa.getIsSupportCPA();
	}
}
